<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <select value="" id="select" onchange="selectBackground()">
        <option value="red">红</option>
        <option value="green">绿</option>
        <option value="blue">蓝</option>
    </select>
    <script>
        const select = document.getElementById('select')
        let obj = { bg: '' }

        const dom = () => {
            obj.bg = select.value
        }


        const selectBackground = () => {
            dom()
            select.style.backgroundColor = obj.bg
        }
        selectBackground()
    </script>
</body>

</html>